
/* Generated by Interface Builder */

#import "DocApp.h"
#import "Document.h"
#import <appkit/defaults.h>
#import <appkit/OpenPanel.h>
#import <appkit/SavePanel.h>

@implementation DocApp

- newDocument:sender
{
	[Document new];
	if (DEBUGGING) printf("in DocApp new.\n");
    return self;
}

- openDocument:sender
{
	static char *const docTypes[] = {FILEEXT, NULL};
	
	if ([[self openPanel] runModalForTypes:docTypes])
		if ([Document newFromFile:[[self openPanel] filename]] == nil)
			NXRunAlertPanel (NULL, "Could not open file.", "OK", NULL, NULL);
    return self;
}

// Outlet Initialization

- openPanel
{
	if(!openPanel) openPanel = [OpenPanel new];
	return openPanel;
}

- savePanel
{
	if(!savePanel) savePanel = [SavePanel new];
	[savePanel setRequiredFileType:FILEEXT];
	return savePanel;
}

@end
